﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace DataAccess
{
    public class FeedbackDao
    {
        ConnectionDatabase conn;
        SqlConnection con;
        SqlCommand cmd;
        public FeedbackDao()
        {
            conn = new ConnectionDatabase();
        }
        // thêm feedback 
        public void AddFeedBack( int CodeProfile, int CodeSchoolSubjects, int CodeProfileStudent, string Month, string Punctual, string Convered, string Skills, string Support, string Remarks)
        {
            con = conn.GetConnection();
            try
            {
                con.Open();
                cmd = new SqlCommand("SP_AddFeedback", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@CodeProfile", SqlDbType.Int).Value = CodeProfile;
                cmd.Parameters.Add("@CodeSchoolSubjects", SqlDbType.Int).Value = CodeSchoolSubjects;
                cmd.Parameters.Add("@CodeProfileStudent", SqlDbType.Int).Value = CodeProfileStudent;
                cmd.Parameters.Add("@Month", SqlDbType.SmallDateTime).Value = Month;
                cmd.Parameters.Add("@Punctual", SqlDbType.VarChar).Value = Punctual;
                cmd.Parameters.Add("@Convered", SqlDbType.VarChar).Value = Convered;
                cmd.Parameters.Add("@Skills", SqlDbType.VarChar).Value = Skills;
                cmd.Parameters.Add("@Support", SqlDbType.VarChar).Value = Support;
                cmd.Parameters.Add("@Remarks", SqlDbType.Text).Value = Remarks;
                cmd.ExecuteNonQuery();
            }
            catch (Exception e) { throw; }
            finally { con.Close(); }
        }
        public DataTable ShowFeedBack()
        {
            DataTable tbl = conn.ExecuteQueryDataTable("SP_ShowFeedback");
            return tbl;
        }
    }
}
